import { useShios } from './src/index';

const shios = useShios('https://localhost:5001/api/');
// let baseUrl = 'http://localhost:5014/api/Vegetables/12?asd=123';

// var url = new URL('http://localhost:5014/api/Vegetables/12');
// console.log();
// var str = 'Vegetables/13?asd=123';
// console.log(str);

// console.log(str.split(/[/?]/, 1));
// var data = { a: 13 };

// async function test() {
//   shios.isDebug = false;
//   let user = {
//     phone: '15116228315',
//     vcode: '1234231',
//   };

//   let res = await shios.download('http://localhost:5000/api/BatchQRCode/1', {
//     headers: {
//       authorization:
//         'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxIiwibmFtZSI6ImFkbWluIiwicmVmcmVzaF90b2tlbl9pZCI6ImFkZjJjZGEwMzI4MDRiNjg5MzI1YzI3M2M1NTEzZTcxIiwibmJmIjoxNjYyNTE1Nzk3LCJleHAiOjE2NjI1MTc1OTcsImlhdCI6MTY2MjUxNTc5NywiaXNzIjoiZGQxMDAiLCJhdWQiOiJjbGllbnQifQ.ZvffF3GX_Sxpcn44E72l5fpzqOjjYLRUjPLLqq6p3Ig',
//     },
//   });
//   console.log(res);
// }
// test();

let btn = document.getElementById('btn');
if (btn) {
  btn.onclick = async () => {
    // let timeout = setTimeout(() => {
    //   console.log('setTimeout exe');
    // }, 1000);
    // console.log(timeout);
    // clearTimeout(timeout);
    // console.log(timeout);
    // shios.isDebug = true;
    // shios.debounceTime = 10000;
    // let c = await shios.get('Pesticides');
    // console.log(c);
    let cc = await shios.get('a', {
      query: { filename: 'test', username: '123' },
    });
    console.log(cc);
    // await shios.delete('Vegetables', { path: 5 });
    // let a = await shios.post('Vegetables', { data: { name: 'string6' } });
    // console.log(a);
    // let b = await shios.get('Vegetables');
    // console.log(b);
  };
}
